<template>
	<view>
		<view class="msgList">
			<view hover-class="bg-light" :class="item.istop?'bg-light':'bg-white'" @click="tapItem(item)">
				<div class="msgList_item flex align-center" @longpress="long" >
					<!-- 图片组件 -->
					<view class="position-relative">
						<avater :src="item.logo" size="92"/>
						<!-- #ifdef APP-PLUS -->   
						<badge badgeClass="position-absolute" badgeStyle="right: -14rpx;top: -150rpx;" :num="item.noreadnum"/> 
						<!-- #endif -->
						<!-- #ifndef APP-PLUS -->
						<badge badgeClass="position-absolute" badgeStyle="right: -14rpx;top: -164rpx;" :num="item.noreadnum"/>
						<!-- #endif -->
					</view>
					<view class="msgList_item_right flex justify-between align-start ml-1 pt-2 pb-1 pl-1">
						<view class="msgList_item_right1">
							<view class="title">{{item.title}}</view>
							<view class="info">{{item.info}}</view> 
						</view>
						<view class="msgList_item_right2">{{item.time|formatTime}}</view>
						<!-- <view class="msgList_item_right2">{{item.time|formatTimeZh}}</view> -->
						<!-- <view class="msgList_item_right2">{{item.time|formatTimeXz}}</view> -->
					</view>
				</div>
			</view>
		</view>
	</view>
</template>

<script>
	import freeBase from '@/common/mixin/free-base.js';
	import avater from '@/components/free-ui/free-avater';//头像组件
	import badge from '@/components/free-ui/free-badge';//角标组件
	export default {
		mixins:[freeBase],	//uniapp中混入mixin
		components:{avater,badge},
		props:{
			item:[Object,Array],
			index:{
				type:Number,
				default:''
			},
			num:{
				type:Number,
				default:''
			},
			propIndex:{
				type:Number,
				default:''
			},
		},
		data() {
			return {
				
			}
		},
		methods: {
			tapItem(e){
				uni.showToast({
					title:e.title,
					icon:'none'
				});
				uni.navigateTo({
					url:'/pages/tabbar/chat/chat?title='+e.title
				});
			},
			// 长按事件
			long(e){
				let x = 0;
				let y = 0;
				// #ifndef MP-WEIXIN
				if(Array.isArray(e.changedTouches) && e.changedTouches.length > 0){
					x = e.changedTouches[0].clientX;
					y = e.changedTouches[0].clientY;
				};
				// #endif
				// #ifdef MP-WEIXIN
				x = e.detail.x;
				y = e.detail.y;
				// #endif
				this.$emit('long',x,y,this.index);
			}
		}
	}
</script>

<style>
	@import '@/common/free.css';
	@import '@/common/common.css';
	scroll-view ::-webkit-scrollbar {
		width: 0;
		height: 0;
		background-color: transparent;
	}
	::-webkit-scrollbar {
	  display: none;
	}
	/* 消息列表样式 */
	.msgList_item{
		padding: 10px 0px 0px 15px ;
	}
	.msgList_item_right{
		flex: auto;
		border-bottom:#e9e9e9 1px solid ;
	}
	.msgList_item_right1{
		line-height: 24px;
	}
	.msgList_item_right1 .title{
		font-weight: 500;
		font-size:35rpx;
	}
	.msgList_item_right1 .info{
		color: #c5c5c5;
		font-size: 28rpx;
		lines: 1;
		text-overflow: ellipsis;
	}
	.msgList_item_right2{
		color: #c5c5c5;
		font-size: 26rpx;
		margin-right: 12px;
	}
</style>
